#pragma config(Sensor, dgtl2,  armSensor,      sensorTouch)
#pragma config(Motor,  port1,           lbDrive,       tmotorVex393, openLoop)
#pragma config(Motor,  port2,           rbDrive,       tmotorVex393, openLoop)
#pragma config(Motor,  port3,           lfDrive,       tmotorVex393, openLoop)
#pragma config(Motor,  port4,           rfDrive,       tmotorVex393, openLoop)
#pragma config(Motor,  port5,           bin1,          tmotorVex269, openLoop)
#pragma config(Motor,  port6,           bin2,          tmotorVex269, openLoop)
#pragma config(Motor,  port7,           bin3,          tmotorVex269, openLoop)
#pragma config(Motor,  port8,           bin4,          tmotorVex269, openLoop)
#pragma config(Motor,  port9,           spatula1,      tmotorVex269, openLoop)
#pragma config(Motor,  port10,          spatula2,      tmotorVex269, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#include "Vex_Competition_Includes.c"
#define TIMEOUT_CNT_PER_SEC    10
void pre_auton()
{

}
/*void moveArm(int timeoutSec)
{
	int timeout=0;
	motor[port5] = motor[port7] = 100;
	motor[port6] = motor[port8] = -100;
	for(timeout=(timeoutSec*TIMEOUT_CNT_PER_SEC); timeout > 0; timeout--)
  {
		if(SensorValue[armSensor]== 1)
		{
      	break;
    }
  	wait1Msec(100);
	}
	//STOP
	motor[port5] = motor[port6] = motor[port7] = motor[port8] = 0;
}*/

task autonomous()
{
  motor[port1] = motor[port4] = motor[port2] = 127;
  motor[port3] = -127;
  wait1Msec(2000);
  motor[port1] = motor[port4] = motor[port2] = motor[port3] = 0;
  motor[port9] = 70;
  wait1Msec(500);
  motor[port9] = 0;
	motor[port5] = motor[port7] = 127;
  motor[port6] = motor[port8] = -127;
  wait1Msec(2100);
  motor[port5] = motor[port6] = motor[port7] = motor[port8] = 0;
	wait1Msec(1000);
	motor[port5] = motor[port7] = -127;
  motor[port6] = motor[port8] = 127;
	wait1Msec(2100);
	motor[port5] = motor[port6] = motor[port7] = motor[port8] = 0;
	motor[port9] = -70;
	wait1Msec(500);
	motor[port9] = 0;
	motor[port1] = motor[port4] = motor[port2] = -127;
  motor[port3] = 127;
  wait1Msec(2000);
  motor[port1] = motor[port4] = motor[port2] = motor[port3] = 0;
}

task usercontrol()
{
	while(true)
	{
  	motor[port1] = -vexRT[Ch2];
  	motor[port3] = vexRT[Ch2];
		motor[port4] = motor[port2] = -vexRT[Ch3];
		motor[port5] = motor[port7] =(vexRT[Btn5U] - vexRT[Btn5D])*127;
		motor[port6] = motor[port8] =-(vexRT[Btn6U] - vexRT[Btn6D])*127;
		motor[port9] = -(vexRT[Btn7U]-vexRT[Btn7D])*127;
		motor[port10]= (vexRT[Btn8U]-vexRT[Btn8D])*127;
	}
}
